package com.yunhe.common.model.authority;

import java.io.Serializable;

/**
 * 资源树对象
 * @author liuronglei
 */
public class ResourceTree implements Serializable, Comparable<ResourceTree> {
    private Long id;
    private String type;
    private Long code;
    private Object object;
    private Boolean leaf;

    @Override
    public int compareTo(ResourceTree o) {
        if (this.type == null || o.getType() == null) {
            return 0;
        }
        if (this.type.compareTo(o.getType()) > 0) {
            return 1;
        }
        if (this.type.compareTo(o.getType()) == 0) {
            if (this.getCode().compareTo(o.getCode()) > 0) {
                return 1;
            }
            if (this.getCode().compareTo(o.getCode()) == 0) {
                return 0;
            }
            if (this.getCode().compareTo(o.getCode()) < 0) {
                return -1;
            }
        }
        if (this.type.compareTo(o.getType()) < 0) {
            return -1;
        }
        return 0;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public Boolean getLeaf() {
        return leaf;
    }

    public void setLeaf(Boolean leaf) {
        this.leaf = leaf;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

}
